<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>高考倒计时</title>
    <style>
        *{margin: 0;padding: 0;list-style-type: none;}
    </style>
</head>
<body>
    <p class="date">

    </p>
    <script>
        let oPDiv = document.getElementsByClassName("date")[0],
            cEDate = new Date("2025-6-7 00:00:00")//高考时间
        function fn(){
            //最新时间差
            let time = cEDate - new Date(),
                dd = Math.floor(time / 1000 / 60 / 60 / 24);//天
                h = Math.floor(time / 1000 / 60 / 60 % 24);//时
                mm = Math.floor(time / 1000 / 60 % 60)//分
                ss = Math.floor(time / 1000 % 60)//秒
            console.log(mm);
            oPDiv.innerHTML = `距离高考还剩：${addZero(dd)}天${addZero(h)}小时${addZero(mm)}分${addZero(ss)}秒`
       }
    //    aDayArr = ["天","一","二","三","四","五","六"],
    //         y = date.getFullYear(),//年
    //         m = date.getMonth(),//月
    //         d = date.getDate(),//日
    //         h = date.getHours(),//时
    //         mm = date.getMinutes(),//分
    //         ss = date.getSeconds(),//秒
    //         w = date.getDay()//星期
    //     boxDiv.innerHTML = `现在的北京时间为：${y}年${addZero(m + 1)}月${addZero(d)}日,${addZero(h)}时,${addZero(mm)}分,${addZero(ss)}秒,星期${aDayArr[w]}`
       //加0
       function addZero(n){
        return n < 10 ? "0" + n : n
       }
        setInterval(fn,1000)
    </script>
</body>
</html>